package org.example.backend.demos.web.api;

import org.example.backend.demos.web.ManagementModule.entity.Project;
import org.example.backend.demos.web.result.Pages;
import org.example.backend.demos.web.result.Result;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;


public interface projectsApi {
    //获取所有项目 例子 http://localhost:8080/projects/api/allproject
    @RequestMapping(path = "api/allproject", method = RequestMethod.GET)
    @ResponseBody
    ResponseEntity<Result> Allproject();

    //获取项目分页列表 例子 http://localhost:8080/projects/api?project.id=1 此处不可用
    @RequestMapping(path = "api/search", method = RequestMethod.GET)
    @ResponseBody
    ResponseEntity<Result> queryByPage_limit(Project project,  PageRequest pageRequest);

    // 获取项目分页列表 例子 http://localhost:8080/projects/api/page?page=1&size=10
    @RequestMapping(path = "api/page", method = RequestMethod.GET)
    @ResponseBody
    ResponseEntity<Result>queryByPage(int page, int size);

    // 获取项目分页列表 例子 http://localhost:8080/projects/api/page_Pages?page=1&size=10
    @RequestMapping(path = "api/page_Pages", method = RequestMethod.GET)
    @ResponseBody
    ResponseEntity<Result>queryByPage_Pages(Pages pages);

    //获取项目详情 例子 http://localhost:8080/projects/api/1
    @RequestMapping(path = "api/{id}", method = RequestMethod.GET)
    @ResponseBody
    ResponseEntity<Result> queryById(@PathVariable("id") Long id);

    //新增数据(需管理员权限) 例子 http://localhost:8080/projects/api/add?title=1&description=1&content=1&status=1
    @RequestMapping(path = "api/add", method = RequestMethod.POST)
    @ResponseBody
    ResponseEntity<Result> add( Project project);

    //更新项目(需管理员权限) 例子 http://localhost:8080/projects/api/update
    @RequestMapping(path = "api/update", method = RequestMethod.PUT)
    @ResponseBody
    ResponseEntity<Result> edit(Project project);

    //删除项目(需管理员权限) 例子 http://localhost:8080/projects/api/delete/1
    @RequestMapping(path = "api/delete", method = RequestMethod.DELETE)
    @ResponseBody
    ResponseEntity<Result> deleteById(Long id);

    //模糊查询 例子 http://localhost:8080/projects/api/blur
    @RequestMapping(path = "api/blur", method = RequestMethod.GET)
    @ResponseBody
    ResponseEntity<Result> blurAll( @RequestParam(required = false) String value);

}
